package com.ruoyi.fztz.zzzecx.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.fztz.xmgjbcx.service.IXmgjbService;
import com.ruoyi.fztz.xmgjbcx.vo.XmgjbVo;
import com.ruoyi.fztz.zzzecx.service.IZzzeService;
import com.ruoyi.fztz.zzzecx.vo.ZzzeVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * 载账总额Controller
 *
 * @author huacai
 * @date 2024-11-25
 */
@RestController
@RequestMapping("/fztz/zzze")
public class ZzzeController extends BaseController {
    @Resource
    private IZzzeService zzzeService;

    /**
     * 根据条件查询载账总额列表
     * @param ksNf 开始年份
     * @param jsNf 结束年份
     * @param xmName 项目名称
     * @return 载账总额
     */
    @GetMapping(value = "/selectZzZeList")
    public AjaxResult selectZzZeList(String ksNf, String jsNf, String xmName) {
        ZzzeVo zzzeVo = new ZzzeVo();
        zzzeVo.setXmName(xmName);

        int startYear = Integer.parseInt(ksNf);
        int endYear = Integer.parseInt(jsNf);
        List<String> yearList = IntStream.rangeClosed(startYear, endYear)
                .mapToObj(String::valueOf)
                .collect(Collectors.toList());
        zzzeVo.setYearList(yearList);

        List<ZzzeVo> results = zzzeService.selectZzZeList(zzzeVo);
        return AjaxResult.success(results);
    }







}
